﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Np.GalleryDownloader.Classes
{
    public static class FileInfoEx
    {
        public static string FileName(this FileInfo file)
        {
            var parts = file.FullName.Split('\\');
            var fullFilename = parts.Last();
            var fileNameParts = fullFilename.Split('.');

            string filename = string.Empty;

            bool isFirst = true;

            for (int i = 0; i < fileNameParts.Length - 1; i++)
            {
                if (!isFirst)
                {
                    filename += ".";
                    isFirst = false;
                }
                filename += fileNameParts[i];
            }
            return filename;
        }
    }
}
